Skip to content

fix(release): collect the changelog in its own job, via a PR when pushes are refused - #388

Merged
jdfalk merged 4 commits into
mainfrom
fix/release-changelog-collect-via-pr
Nov 6, 2026
Merged

jdfalk merged 4 commits into
mainfrom
fix/release-changelog-collect-via-pr

Conversation

@jdfalk

@jdfalk jdfalk commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Why

audiobook-organizer's production release v0.223.0 (run 42228750978) created its release and every asset. Then Create GitHub Release failed with GH013: Repository rule violations found for refs/heads/main when it pushed the collected CHANGELOG.md. That repo now has a merge-queue ruleset with no bypass. The collect step ran ahead of check-release, which writes release-created, so Publish GitHub Packages was skipped.

Change (reusable-release.yml)

  • Own job: collection moves to collect-changelog, which runs after create-release (!cancelled() and release-created == 'true'). A failure there turns the run red but no longer skips publishing. build-status waits for it.
  • Decide first: a plan step decides whether to collect before any token is minted. It requires all of these:
    • the released commit is on the default branch (merge-base --is-ancestor, so a tag-push release on main still collects);
    • scriv.ini exists and CHANGELOG.md has its marker;
    • fragments are pending.
  • Only the changelog moves: it collects at the released commit and checks the commit touches only CHANGELOG.md and changelog.d/. It then cherry-picks that one commit onto a fresh fetch of the default branch. The old step pushed or rebased the checkout's own history, so a release cut from another branch could carry that branch's commits.
  • Direct push first, as before. On a protection or ruleset refusal it opens a same-repo PR from changelog/collect-<version>:
    • Token: the CI_APP_ID App token, or JF_CI_GH_PAT. Not GITHUB_TOKEN, because a PR opened with it starts no checks.
    • Lookup: the PR is found by number and isCrossRepository == false, and merged with --match-head-commit.
    • Merge: --rebase --auto first, falling back to a plain --rebase merge (never --admin).
    • Commit and title: the commit drops [skip ci]; the title carries [skip changelog].
  • No double collection: it refuses to collect while an earlier version's changelog PR is still open, checking up to 1000 open PRs. A re-run of the same version reuses its own PR, and a token that can't list PRs only warns.

Not changed: update-floating-tags

It is still skipped whenever build-* jobs are skipped, because its if: has no status function. That's existing behaviour and isn't caused by the changelog failure. Turning it on would create annotated v0 / v0.N tags on each release commit. git describe prefers those over vX.Y.Z, which would change audiobook-organizer's build version stamps. Whether it becomes an opt-in input is a separate decision.

Review

An independent agent reviewed this in two rounds; both rounds' findings are addressed in these commits. A security review also checked it: it flagged carrying history across and resolving PRs by head name, and both are fixed. actionlint is clean.

Test plan

  • The next audiobook-organizer stable release: collect-changelog opens and auto-merges a PR, and publish-github-packages runs.

🤖 Generated with Claude Code

https://claude.ai/code/session_011To9HQJLrCH6wYa5WCpw3L

…hes are refused

Changelog collection was the last step of create-release, before the
step that writes release-created. A ruleset refusal (GH013) failed the
job before that output existed, so publish-github-packages and
update-floating-tags skipped a release that was otherwise complete.

Move it to a collect-changelog job after create-release. Keep the
direct push; on a protection refusal open a changelog/collect-<version>
PR with the CI App token (falling back to the PAT, then GITHUB_TOKEN)
and enable rebase auto-merge so a merge queue takes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011To9HQJLrCH6wYa5WCpw3L
jdfalk and others added 3 commits November 6, 2026 10:07
…ock floating tags

Review of #388: update-floating-tags had no status function, so an
implicit success() and the skipped build-* jobs skipped it on every
release. Give it and collect-changelog !cancelled().

Collect: decide whether to collect before minting a token; skip a
release not cut from the default branch; refuse while an earlier
changelog PR is open; check the commit touches only the changelog;
cherry-pick it onto a fresh fetch of the default branch for both the
direct push and the PR; open the PR with the App token or the PAT only;
fall back to a plain rebase merge when auto-merge cannot be enabled.
build-status waits for the job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011To9HQJLrCH6wYa5WCpw3L
…d to the pushed commit

gh pr merge <branch> resolves by head name, which a fork PR can share.
Look the PR up with isCrossRepository == false, merge it by number
with --match-head-commit, and filter the pending-PR guard the same
way. The plain-merge fallback stays (it never passes --admin) but is
pinned the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011To9HQJLrCH6wYa5WCpw3L
…ch; leave floating tags alone

Re-review of #388. Comparing github.ref_name to the default branch
skipped every tag-push release (burndown-runner-image), so test
ancestry instead. The pending-PR guard lists up to 1000 PRs, skips
this version's own branch so a re-run reuses its PR, and only warns
when the token cannot list PRs.

Revert the !cancelled() on update-floating-tags: the job has never run
for callers with skipped build-* jobs, and turning it on makes
annotated v0/v0.N tags on the release commit that git describe prefers
over vX.Y.Z (audiobook-organizer stamps builds from git describe).
Whether floating tags become an input is a separate decision.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011To9HQJLrCH6wYa5WCpw3L
@jdfalk
jdfalk merged commit 23ed8a4 into main Nov 6, 2026
60 checks passed
jdfalk added a commit that referenced this pull request Nov 6, 2026
…ock floating tags

Review of #388: update-floating-tags had no status function, so an
implicit success() and the skipped build-* jobs skipped it on every
release. Give it and collect-changelog !cancelled().

Collect: decide whether to collect before minting a token; skip a
release not cut from the default branch; refuse while an earlier
changelog PR is open; check the commit touches only the changelog;
cherry-pick it onto a fresh fetch of the default branch for both the
direct push and the PR; open the PR with the App token or the PAT only;
fall back to a plain rebase merge when auto-merge cannot be enabled.
build-status waits for the job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011To9HQJLrCH6wYa5WCpw3L
@jdfalk
jdfalk deleted the fix/release-changelog-collect-via-pr branch November 6, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github-actions GitHub Actions related work module:config Configuration management size/L type:documentation Improvements or additions to documentation workflow:github-actions GitHub Actions workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant